#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
  printf("fork 1 before\n");
  printf("fork 2 before\n");
  printf("fork 3 before\n");
  printf("fork 4 before\n");
  printf("fork 5 before\n");
  pid_t pid = fork();
  if(pid < 0)
  {
    fprintf(stderr,"fork is fail\n");
    return -1;
  }
  if(pid == 0)
  {
    printf("I am a child ,my pid is %d,my father pid is %d\n",getpid(),getppid());
  }

  if(pid > 0)
  {
    printf("I am a father,my son is %d,my pid is %d\n",pid,getpid());
  }

  printf("==============================\n");
  return 0;
}
